package day1105.second;

import day1105.common.MyUtil;
import day1105.common.Student;

import java.util.List;

import static day1105.common.MyUtil.printLine;

/**
 * @author Mr.ma
 * @since 2022/11/6 15:53
 **/
public class MatchTest {
    public static void main(String[] args) {
        List<Student> studentList = MyUtil.createStudentList();
        studentList.stream().forEach(System.out::println);
        printLine("学生是否都已成年");
        boolean b = studentList.stream().allMatch(s -> s.getAge() >= 18);
        if (b){
            System.out.println("学生都已成年");
        }else {
            System.out.println("存在未成年学生，请注意授课方式");
        }
        printLine("是否存在成绩优秀的学生（90分及以上）");
        boolean b1 = studentList.stream().anyMatch(s -> s.getScore() >= 90.0);
        if (b1){
            System.out.println("存在优秀学生");
        } else {
            System.out.println("这届学生废了");
        }
        boolean b2 = studentList.stream().noneMatch(s -> s.getScore() > 90.0);
        if (!b2){
            System.out.println("存在优秀学生");
        } else {
            System.out.println("这届学生废了");
        }
    }
}
